#include<bits/stdc++.h>
using namespace std;

int cnt[1010];

int main()
{
	int a, b, n;
	cin>>n;
	for(int i = 1;i <= n;i++)
	{
		cin>>a>>b;
		cnt[i] = cnt[i-1]+b-a;
	}
	cout<<*max_element(cnt+1, cnt+n+1);
	return 0;
}

